package com.itheima.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//创建分页查询插件
@Configuration
public class MybaisPlusConfig {

    //构建对象
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        //创建拦截器对象
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //添加一个具体的拦截器
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        //返回一个结果
        return interceptor;
    }
}
